package com.flowCloud.web.service.tbl_log.impl;


import com.flowCloud.result.LayDatas;
import com.flowCloud.util.MapTrunPojo;
import com.flowCloud.util.page.LayuiPageUtils;
import com.flowCloud.util.page.PageUtils;
import com.flowCloud.web.bean.*;
import com.flowCloud.web.controller.tbl_log.vo.*;
import com.flowCloud.web.dao.*;
import com.flowCloud.web.service.tbl_log.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Author: 系统自动生成
 * @Date: 2021-01-18
 * @Description: TblLog 服务接口层
 */
@Service
@Slf4j
public class TblLogServiceImpl implements TblLogService {

    @Autowired
    private TblLogDao tblLogDao;

    /**
     * @Description: 查询一条
     * @Author: 系统自动生成
     * @Date: 2021-01-18
     * @param vo
     */
    @Override
    public TblLogBean getInfoByParam(GetInfoByParamVo vo) {
        //转换类型
        Map<String, Object> stringObjectMap = MapTrunPojo.object2Map(vo);
        return tblLogDao.findOne(stringObjectMap);
    }

    /**
     * @Description: 查询多条
     * @Author: 系统自动生成
     * @Date: 2021-01-18
     * @param vo
     */
    @Override
    public List<TblLogBean> getInfoListByParam(GetInfoListByParamVo vo) {
        //转换类型
        Map<String, Object> stringObjectMap = MapTrunPojo.object2Map(vo);
        return tblLogDao.findList(stringObjectMap);
    }

    /**
     * @Description: 分页查询
     * @Author: 系统自动生成
     * @Date: 2021-01-18
     * @param vo
     */
    @Override
    public LayDatas getPageInfo(GetPageInfoVo vo) {
        //计算分页
        PageUtils pageUtils=new PageUtils(vo.getPage(),vo.getLimit());
        //转换类型
        Map<String, Object> stringObjectMap = MapTrunPojo.object2Map(vo);
        stringObjectMap.put("page",pageUtils.getPage());
        stringObjectMap.put("limit",pageUtils.getLimit());
        //查询数据
        List<TblLogBean> list = tblLogDao.findList(stringObjectMap);
        //查询总数
        int count = tblLogDao.findListCount(stringObjectMap);
        return LayDatas.data(count,list);
    }

    /**
     * @Description: 添加
     * @Author: 系统自动生成
     * @Date: 2021-01-18
     * @param vo
     */
    @Override
    public int add(AddVo vo) {
        //转换类型
        Map<String, Object> stringObjectMap = MapTrunPojo.object2Map(vo);
        return tblLogDao.insert(stringObjectMap);
    }

    /**
     * @Description: 修改
     * @Author: 系统自动生成
     * @Date: 2021-01-18
     * @param vo
     */
    @Override
    public int update(UpdateVo vo) {
        //转换类型
        Map<String, Object> stringObjectMap = MapTrunPojo.object2Map(vo);
        return tblLogDao.update(stringObjectMap);
    }

    /**
     * @Description: 删除
     * @Author: 系统自动生成
     * @Date: 2021-01-18
     * @param vo
     */
    @Override
    public int delete(DeleteVo vo) {
        //转换类型
        Map<String, Object> stringObjectMap = MapTrunPojo.object2Map(vo);
        return tblLogDao.delete(stringObjectMap);
    }
}

